/**
 * 选择城市
 * Created by wujianjin on 2015/7/14.
 */

define(function (require, exports, module) {
    'use strict';
    module.exports = function (app) {
        app.register.controller('selectCityCtrl', ['$scope', 'MHService', '$location',function ($scope, MHService,$location) {
//            $scope.url = MHService.URL.city_list;
            MHService.getReq({url: MHService.URL.city_list}, function (data) {
                if(data){
                    $scope.cities = data.datas;
//                    console.log("14",$scope.cities);
                }else{
                    MHService.Toast('获取城市列表失败');
                }

            });

            $scope.setCity = function(c){
                //将当前城市对象保存，接下来会用到
                MHService.globalData(true, {key: 'city', value: c});

                $location.path("building");
//                var cityid = MHService.globalData(false, {key: 'cityid'});

            }
        }]);
    };
});

